package twoD.IsoPfem;

import inf.text.ArrayFormat;

public class Force {
	private double[] components_;

	public Force(double... r) {
		components_ = new double[r.length];
		for (int i = 0; i < r.length; i++)
			components_[i] = r[i];
	}

	public double getComponent(int c) {
		return components_[c];
	}

	public void scale(double s) {
		// this method is useful when setting load control configuration
		for (int i = 0; i < components_.length; i++)
			components_[i] *= s;
	}

	public Force multiply(double s) {
		// this method is useful when setting load control configuration
		Force f = new Force(components_);
		f.scale(s);
		return f;
	}

	public void add(double... f) {
		// this method is useful when setting load control configuration
		for (int i = 0; i < components_.length; i++)
			components_[i] += f[i];
	}

	public void print() {
		System.out.print(ArrayFormat.format(components_));
	}
}
